home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
batch
/
SW_43.ARJ
/
SW-43.DOC
< prev
next >
Wrap
Text File
|
1992-07-11
|
47KB
|
1,047 lines
╔═══════════════════════════════════╗
║ ║▒▒
║ SW.EXE ║▒▒
║ Batch File Enhancement ║▒▒
║ Version 4.3 ║▒▒
║ ║▒▒
╚═══════════════════════════════════╝▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
July 11, 1992
SW.EXE 4.2a
Warren Small
(c) 1992
TABLE OF CONTENTS
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
SW.EXE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
DI.EXE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
OPTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
NOTES ON DOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
WINDOW APPEARANCE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
/F# Foreground Color /B# Background Color . . . . . . . . . . . 3
Color Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
/L# Window Border (Lines) . . . . . . . . . . . . . . . . . . . . . 3
/S# Shadows . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
/W Wide Edge . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
/2 Double Spacing /0 No Margin . . . . . . . . . . . . . . . . 3
/R# Row /C# Column . . . . . . . . . . . . . . . . . . . . . . . 4
/H# Here . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
/D Draw Window . . . . . . . . . . . . . . . . . . . . . . . . . . 4
/Z Zoom Window . . . . . . . . . . . . . . . . . . . . . . . . . . 4
TEXT APPEARANCE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
/T# Text Color /G# Global Text Color . . . . . . . . . . . . . . 5
/E# Enhanced Text Color . . . . . . . . . . . . . . . . . . . . . . 5
/M# Border Message . . . . . . . . . . . . . . . . . . . . . . . . 5
/J# Justify . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
SCREEN APPEARANCE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
/K# Klear Screen (with optional Fill Character) . . . . . . . . . . 6
/K# Klear Screen, set Foreground Color . . . . . . . . . . . . . . 6
/K# Klear Screen (with optional Fill String) . . . . . . . . . . . 6
/O# Outside Edge (Screen Border) . . . . . . . . . . . . . . . . . 6
/X# Xtra Lines . . . . . . . . . . . . . . . . . . . . . . . . . . 6
OTHER SWITCHES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
/P# Pause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
/Q Query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
/I# User Input . . . . . . . . . . . . . . . . . . . . . . . . . . 8
/N# Input Line Number . . . . . . . . . . . . . . . . . . . . . . . 9
/U Input Uppercase . . . . . . . . . . . . . . . . . . . . . . . . 9
/D Draw Window . . . . . . . . . . . . . . . . . . . . . . . . . . 9
/ch Fill Line . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
/A# Alert /A#,# Alert with Frequency, Duration . . . . . . . . . 10
DEFAULTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
SCREEN DEFINITIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
TIPS AND TRICKS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
SHAREWARE INFORMATION . . . . . . . . . . . . . . . . . . . . . . . . . . 15
SW.EXE History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
SW.EXE 4.2a
Warren Small
(c) 1992
SW.EXE 4.2a
Warren Small
(c) 1992
INTRODUCTION
The batch file language for the IBM PC could be described as useful but
not much else. It is lacking a great deal in terms of flexibility. These 2
utilities, SW.EXE and DI.EXE, attempt to make batch files much more powerful
and at the same time make them nice to look at.
SW.EXE grew out of my hatred for the ECHO statement. Any time that I
needed to say something to the user, ECHO was the only way. It was slow and
difficult to make look halfway decent. And if I wanted color, there was
ANSI.SYS...
DI.EXE was introduced with SW 4.1 as a response to users who have been
utilizing SW as an install tool for software distribution. DI allows interro-
gation of the disk drives to determine if they are ready for whatever use you
had in mind. This way you can avoid hardware errors which can pop up in the
middle of your nice SW screens. See DI-13.DOC for the details on using DI.
SW.EXE will display up to 20 lines of text in a window using either its
command line format or an external 'Screen Definition' file. With either
method, the color of each line can be defined separately or as a group. Also,
the colors for the window, its border, the screen background and its border
can be specified. Five different window borders are possible and the screen
background can be filled with characters or complete strings.
SW.EXE also provides functions for retrieving input from the user,
either single keystrokes or strings, controlling batch file execution through
branching and alerting the user with various sounds or even simple tunes.
Command Line Syntax:
SW [options] "text1" [options] ["text2"] [options] ["text3"] ...
External File Syntax:
SW @filename [label]
The biggest advantage to using the external file approach is that more
than one window can be displayed with only one call to SW! This can be a
tremendous speed advantage if the batch file is being run from a floppy disk.
The screen definition can also be written into the batch file that utilizes
it so that disk space is used optimally. The optional label shown above is
used to mark different definitions within the same file. The demo batch file,
SW43DEMO.BAT, contains many examples of both methods. See page 12 for more
information.
On the next page is a list of the various switches along with a short
description of what each does. This list appears on the screen when SW is
called without parameters.
Page 1
SW.EXE 4.2a
Warren Small
(c) 1992
OPTIONS
Window: /f# Foreground (0-15) /b# Background (0-7) /l# Border (0-5)
/s# Shadow (1-4) /w Wide Edge /2 Double Spacing /0 No Margin
/r# Row (1-25) /c# Col (1-80) /h# here + # /d Draw /z Zoom
Text: /t#|g# Text (0-15) /e# Enhanced Text /m# Border Msg /j# Justify
Screen: /k#[ ] Clear screen with color (0-7) [char] /o# Outside edge
Other: /p#[-] Pause /a#[,#] Alert (0-9) /q... Query /char Fill Line
/i# User Input /n# Input Line /u Uppercase /x% Xtra Lines
Switches can be in almost any order, upper or lower case (except /q and
/i, see page 7), and a space is required between each.
NOTES ON DOS
- There is a limit to the length of a command line whether it is typed
directly from the DOS prompt or inside a batch file. This limit is 128 char-
acters. Anything past that point will be ignored.
- The Query feature described on page 7 makes use of Errorlevel codes to
allow the batch file to determine which key has been pressed. A series of IF
ERRORLEVEL x statements are used to test for the value. You must test from
largest to smallest since the statement will be true if the value is equal to
OR greater than x.
- The User Input feature (page 8) and four DI switches make use of the
DOS Environment. (DOS 3.3 or higher is required for these features) This is
an area in memory containing information stored by your boot up procedure as
well as some programs. You can see this information by typing SET from the
command line. There are three variables commonly found in the environment.
PATH is a list of directories DOS will search to find a program not in the
current directory. You must set this yourself, usually as part of the
AUTOEXEC.BAT file. COMSPEC tells DOS where to find COMMAND.COM. If it is
anywhere but the root directory of the boot drive, you will have to set it.
PROMPT describes what the DOS prompt will look like. Your DOS manual has more
information.
- To check the answers returned by User Input, the IF statement is used.
In your batch file, the variable name must be preceded and followed the %
sign. On page 8 is a quick example. If you wish to check the actual value use
this form:
IF "%ANS%"=="" goto Label
This will branch to Label if the user entered nothing. Use IF NOT to reverse
the logic of the comparison. Adding NOT to the above example would branch to
Label if ANS had some value.
- To be sure there is room in the environment you can set the size
manually when booting. "SHELL=C:\COMMAND.COM /E:512 /P" in your CONFIG.SYS
file will set the size to 512 bytes. This value can be as large as 32768.
Page 2
SW.EXE 4.2a
Warren Small
(c) 1992
WINDOW APPEARANCE
/F# Foreground Color /B# Background Color
Foreground and background colors for the window are set by the /f# and
/b# switches. The color can be selected using the numbers or names.
Valid background colors are limited to 0-7. If your command line gets to
be longer than 128 characters, use the numbers to gain some space. DOS
will ignore anything past the 128th position on the command line.
Color Values
0 or bla = Black 8 or BLA = Grey
1 or blu = Blue 9 or BLU = Bright Blue
2 or gre = Green 10 or GRE = Bright Green
3 or cya = Cyan 11 or CYA = Bright Cyan
4 or red = Red 12 or RED = Bright Red
5 or mag = Magenta 13 or MAG = Bright Magenta
6 or yel = Brown 14 or YEL = Yellow
7 or whi = White 15 or WHI = Bright White
/L# Window Border (Lines)
Border type is defined by the /l# (line) switch.
/l0 - none /l1 - ┌─ /l2 - ╔═
/l3 - ╒═ /l4 - ╓─ /l5 - █▀
If a character is used instead of a number, it will be used as the
window border. (e.g. /l* or /l▓).
/S# Shadows
A shadow can be added with the /s# option. If the shadow covers other
characters on the screen they will be darkened, rather than hidden.
/s1 - right, below (default if /s is used alone)
/s2 - left, below
/s3 - right, above
/s4 - left, above.
/W Wide Edge
The /w switch will give your window a wide edge, making it 2 rows taller
and 4 columns wider. Using this option will reduce the maximum string
length to 64 and the maximum number of lines from 20 to 18 if you are
using a screen definition. The /w switch will have no effect on a window
with no border (/l0).
/2 Double Spacing /0 No Margin
The /2 option will add a blank line between each text line passed. The
/0 switch removes the blank space between the border and first and last
lines of text. Combine /0 with the /l0 switch and the resulting window
will be only as large as needed for the text passed.
Page 3
SW.EXE 4.2a
Warren Small
(c) 1992
/R# Row /C# Column
The position of the window can be set using the /r# (row) and /c#
(column) switches. These are referenced to the upper left corner of the
window. If the window is too big to fit, these coordinates will be
adjusted by the program. Thus if you have a line that places a window in
the lower right hand corner and you want to add a shadow, just put a /s
on the end of the line and the window will be positioned properly
without changing the row and column switch values.
If you wish to set the size of the window yourself, a second /r# and /c#
will define the bottom row and right column. If the text passed to SW
will not fit in the window, these settings will be adjusted by SW
automatically, adjusting the bottom and right sides first. If you set
only top and bottom or left and right, SW will calculate the proper
values for you.
A shorthand version of absolute sizing is available. You can now show
the start and end with one switch for the height, /r#### and one for the
width, /c####. The first 2 digits are the start value. /r1020 is equiva-
lent to /r10 /r20, saving 3 characters on the line.
/H# Here
For simpler positioning, /h# (here) will set the row according to the
present cursor position adding # to it if provided. The value can be
plus or minus. Use the /h# switch when you're trying to mix screen
output from another program with an SW window. The window can be easily
placed relative to the other text and will be centered left to right
unless you use the /c# switch.
/D Draw Window
When a Pause, Query or User Input is utilized, the window will "popup"
on the screen and disappear when the pause finishes or the input has
been processed. If you want the window to be left on the screen, specify
the /d switch. This will draw the window instead. See page 7 for more
information on Pause, Query and User Input.
┌──────────────────────────────────────────────────────────────────────┐
│ NOTE TO PREVIOUS USERS - Since Pause, Query and User Input windows │
│ now disappear when the function is completed, you may wish to change │
│ your batch files by adding the /D switch. │
└──────────────────────────────────────────────────────────────────────┘
/Z Zoom Window
A special effect for SW is Zoom Window. Sometimes called "exploding" by
other applications, this switch will cause the window to be drawn in
several steps, from small to its final size. The shadow and border are
zoomed as well with the text added when the proper size is reached.
Page 4
SW.EXE 4.2a
Warren Small
(c) 1992
TEXT APPEARANCE
/T# Text Color /G# Global Text Color
Text color can be controlled with the /t# and /g# switches. Both use the
same color table shown above and both are position sensitive. /g# will
change the text color for all text following the switch. /t# will effect
only the text string immediately after the switch. Multiple /g# switches
could be used to color groups of lines. To make "text" blink, add 128 to
the color # or put a + after the color name. (e.g. red+ = 4 + 128 = 132
= blinking red). The window foreground color can also blink if desired.
/E# Enhanced Text Color
This switch selects the "enhanced" text color. This is the color used
when you want to highlight a character within a line. In the Query
example below the ~ (tilde) character preceding the 'Y' and 'N' will
cause these characters to appear bright red (/eRED) while the rest of
the text is the default bright white. If the e parameter is omitted,
SW.EXE will use the color of the current line with the opposite intensi-
ty. There is no limit to the number of characters that can be highlight-
ed on each line.
/M# Border Message
A /m# preceding a text string marks the string as a Border Message. If
it is the first string in the window, it will appear at the top. If it
appears after the first line of regular text, the message will appear at
the bottom. The # must be l, r or c for left, right and center. Center
is the default if /m is used alone. The message color is defined the
same way as all other text with /t#, /g#, and /e#.
/J# Justify
Text can be justified (aligned) to the left or right as well as the
default centering. This switch works on all strings following its
position, just like /g#. /jl will align text left and /jr will line up
the text to the right. /jc would restore the default.
Page 5
SW.EXE 4.2a
Warren Small
(c) 1992
SCREEN APPEARANCE
/K# Klear Screen (with optional Fill Character)
The /k# switch will clear the screen using the color # (0-7) and places
the cursor at the upper left corner. A single character can be added
after the # to give some texture to the screen. (e.g. /k4─ or /kred─)
This can make the shadow effect more interesting.
/K# Klear Screen, set Foreground Color
A second /k# switch on the same line can be used to set the screen fore-
ground color (0-15). SW /kblu /kWHI sets the screen color to bright
white on blue. This will NOT affect the current DOS screen color. The
default screen foreground value is 7 or whi.
/K# Klear Screen (with optional Fill String)
Instead of a simple fill character for the background, a string could be
used in the form /k#string. The string can be up to 80 characters long.
Interesting patterns will result depending on the length. Lengths like
2, 4, 5, 8, 10, etc. divide into 80 evenly. Other values result in each
line being offset from the last. Don't limit yourself to just words. Use
some of the special IBM characters in different combinations. The Demo
batch file has some examples. If you want spaces within the string,
either surround the string with quotes or substitute the underscore (_)
for each space. They will be replaced by spaces before being displayed.
/O# Outside Edge (Screen Border)
The /o# switch will set the screen border color. All color values are
valid. Using the switch without a color will reset the border to normal.
This switch could be used alone to set or reset the border. SW /ored
will set the screen border to red. Some programs ignore the border
color, others reset it and still others set one of their own. You will
have to experiment on your own is you wish to set a special border color
for a program.
/X# Xtra Lines
SW 4.3 is now EGA 43 and VGA 50 line aware, i.e. if the screen is
already in one of those modes, SW will be able to utilize the entire
screen. This switch provides a way for SW to setup 43 and 50 line
displays by using /X43 and /X50 respectively. /X25 will return to the
normal 25 line mode. The maximum text lines displayed in a box is
increased to 38 in the 43 line mode and 45 in the 50 line mode.
Page 6
SW.EXE 4.2a
Warren Small
(c) 1992
OTHER SWITCHES
/P# Pause
The /p# switch will pause for # 10ths of a second before proceeding. If
# = 0 or is missing the program will wait for the user to press a key.
If you combine Query and Pause, the pause will occur after the query
unless the query specifies a default (See below). Adding a - after the
number will allow the user to interrupt the timer. e.g. /p50- will pause
for 5 seconds or less if the user presses a key. Maximum value for pause
is 300 or 30 seconds.
/Q Query (Controlled Branching)
The Query switch (/q...) allows user input of single characters. The
selected key sets the DOS Errorlevel allowing conditional branches in
your batch file.
Example: sw /eRED "Continue?" "~Yes ~No" /qyn
if errorlevel 2 goto exit
if errorlevel 1 goto next
This will wait for the user to press the 'y' or 'n' key rejecting all
other keystrokes with a 'beep'. If 'n' is pressed, Errorlevel 2 will be
set and the batch file will branch to the label ":exit". 'y' will cause
a branch to ":next".
/Q Special Characters, ~ ` ^ *
If the ~ (tilde) character immediately follows the /q, the ESC key is
also available and will set Errorlevel 0 if pressed. Up to 70 characters
can be designated as option keys. If you wish to use the space bar or
the piping (|) and redirection (< or >) characters, enclose all the
characters in quotes. (e.g. /q"abc "). Query is not case-sensitive.
The ` or ^ character can be used to indicate a default choice for the
Query. This choice is available to avoid conflicts with NDOS/4DOS.
Example: sw /eRED "Continue?" "~Yes ~No" /q^yn
This makes a 'Y' the default. SW will return Errorlevel 1 if ENTER is
pressed. Also, by combining a pause with a default choice, SW will
return the default if no key is pressed before the pause time elapses.
An asterisk (*) used in the Query string acts like a wild card choice.
SW will return an Errorlevel corresponding to its position in the
string.
Example: sw /eRED "Press ~Y to Continue" "Any other key to abort" /qy*
'Y' returns Errorlevel 1 and all other keys return 2. ESC and/or a
default response could be combined with the wildcard option as well.
Pressing ENTER would then return the default choice as would a Pause
timeout.
Page 7
SW.EXE 4.2a
Warren Small
(c) 1992
Users who wish SW to flush the keyboard buffer prior to checking for
Queries can use an uppercase /Q switch rather than a /q. In both cases,
the result of the query is the same.
/I# User Input (Requires DOS 3.3 or higher)
The /i# switch will add an edit line to the window which will accept
User Input. The # defines the length of the line. This feature can be
used to ask for directory names, file names, drive letters or other
information which can then be used by the batch file. SW will put the
answer in the batch file's environment with the label ANS. DOS 3.3 or
higher is needed for this feature. You can then use the ANS variable in
your batch file. A Pause used with this feature will occur after the
input.
Example: sw "Which Directory?" /i40
if exist %ans%\nul cd %ans%
This does has some limitations since it is difficult to check the
validity of the answer from a batch file.
┌─────────────────────────────────────────────────────────────────────┐
│ NOTE TO SW 3.8 USERS: If you have used the /i# switch in your batch │
│ files, be sure to remove the line "CALL SW-ENV.BAT" since this │
│ version does not create the batch file in favor of direct manipula- │
│ tion of the environment. │
└─────────────────────────────────────────────────────────────────────┘
/I#var User Input, Custom Variable Name
Optionally, you can specify your own environment variable name with the
/i# switch. The variable is indicated by a string, up to 8 characters
long, placed after the number. e.g. /i24Dir gives you a 24 character
field and places the answer in the environment variable DIR. (All
environment variables are shifted to upper case.) This allows you to get
more than one string before processing. Just be sure your environment is
sized properly. Check the SHELL command in your DOS manual.
The string input editing keys include HOME, END, , , BackSpace, DEL,
INSert and Overtype modes and use of the ESCape key for aborting. A
large cursor indicates the Overtype mode and a small cursor signifies
Insert.
IMPORTANT NOTE: SW 4.2a altered the action of ESC by NOT changing the
original value and returning EL 1 to the batch file. This prevents
unnecessary alteration of the environment. If an error occurs when SW
tries to add the result to the environment, an EL 2 will be returned. EL
0 is returned with normal input.
When using the /I switch, SW will check the environment to see if the
variable you are using is already present. If it is, the value will be
used as a default value in the User Input field. A SET command should
always precede an SW call with the /I switch. If you do NOT want a
Page 8
SW.EXE 4.2a
Warren Small
(c) 1992
default, you have to make sure the variable is not present. 'SET ANS='
preceding the input call will make sure there is no value in the ANS
variable.
Like the /Q switch, /I in SW 4.2 will flush the keyboard buffer if an
uppercase /I is used rather than /i. The results for both are equiva-
lent.
/I#### User Input, Long Strings
If you need to get string input that is longer than the maximum field
length of 70 , use the form /I####. The last 2 digits define the field
size and the rest of the number represents the maximum length of the
string. e.g /I8020 defines a 20 character field with a maximum string
length of 80. Additionally, if the default value found in the environ-
ment exceeds the string length, SW will automatically adjust to compen-
sate. However, the string cannot be made any longer. Maximum string
length is 127 characters minus the length of the variable name. Maximum
field length is 70 if it is on a line by itself. The field size will be
adjusted if its length plus the length of text on the same line exceeds
70 or 64 if using wide margins.
/N# Input Line Number
By default, the User Input field is placed on the last line of the box.
By using the /n# switch, the field can be placed on any line. If # is
positive, the field will appear after the string on line #. If # is
negative, the field will appear by itself on line #.
/U Input Uppercase
If you want only uppercase characters in the answer, use the /u switch.
This can be useful when asking for a drive letter and want to put the
results on the screen for verification.
/D Draw Window
Pause, Query and User Input windows "popup" on the screen, i.e they
disappear after the Pause, Query or Input finish. /D is used if you want
the window to stay on the screen.
/ch Fill Line
This parameter is used to indicate a character which will be used to
fill a text line position in the window. Any character that is not
already used by another switch is valid. This switch could be used for
horizontal separators in the text box using a ─ (ASCII 196) or a ═
(ASCII 205). The area filled is just inside the border of the box. The
switch should be positioned as if it were a string on the command line
or within the Screen Definition. Its color can be specified the same as
a normal text line. See the first Screen Definition on Page 12 for an
example of its use.
Page 9
SW.EXE 4.2a
Warren Small
(c) 1992
/A# Alert /A#,# Alert with Frequency, Duration
The Alert switch (/a#) can be used to produce the normal IBM beep if #
is 0 or missing. If that's too boring, nine other sounds can be produced
varying from simple tones to more complex sounds using the values below.
Alert Switch Values
1 - Low Freq Tone 5 - Bweep Two
2 - Mid Freq Tone 6 - Bomb
3 - High Freq Tone 7 - Siren
4 - Bweep One 8 - Phasor
9 - Tweeter
The demo batch file gives you a chance to try them all.
The /A switch can also produce any tone that the PC speaker can put out.
Using the form /A##,##, the first number will be the frequency of the
tone (20-20000) and the second is its duration (1-300 tenths of a
second). Using a screen definition, songs are actually possible using a
series of lines like "_window /a440,1". This produces a 440 hertz tone
for 1 tenth of a second. SW43DEMO.BAT has some short examples. The use
of a screen definition is needed for speed of execution. Trying this
from several command lines in the batch file will result in a less than
smooth output.
For you musicians out there, there is an easier way to create those
little tunes. Notes can be specified with the /A switch as well. Middle
C is designated as C4. A sharp is shown as C4# and a flat as B3b. The
full form of the switch is /AA4,10 which will play an A, 4th octave, for
1 second. The tunes in SW43DEMO.BAT use this form of /A. The valid range
is from E0 to B9. It should be noted that the IBM speaker has limita-
tions in reproducing high notes and the practical limit is probably
around a G9 or about 12,000 Hz.
Page 10
SW.EXE 4.2a
Warren Small
(c) 1992
DEFAULTS
Yellow double line border on a centered blue window with white single-
spaced text. No Clear Screen, Shadow or Zoom. (/fYEL /bblu /gWHI /l2)
Example: sw /kwhi /fblu /bred /gYEL "Line 1" /tWHI "Line 2" "Line 3" /s2
This will display a blue (/fblu) on red (/bred) window with a shadow to
the left and below it (/s2). The screen color will be white (/kwhi). Lines 1
and 3 are bright yellow (/gYEL) and line 2 is bright white (/tWHI). See the
batch file SW43DEMO.BAT for many more examples.
If no text strings are passed, features such as Clear Screen (/k#),
Query (/q...), Pause (/p#), Alert (/a#[,#]), and Outside Edge (/o#) can be
used with no window output. (e.g. sw /p10 will pause for 1 second.)
Page 11
SW.EXE 4.2a
Warren Small
(c) 1992
SCREEN DEFINITIONS
Screen Definitions, introduced with version 4.0, greatly enhance the
flexibility and power of SW. It simplifies the command line by putting all
the switches and text into a file that SW can read into memory. Multiple
windows can be defined in the file and displayed with one call to SW. Also,
text handling by one window is expanded to 20 single spaced lines.
When you run SW43DEMO.BAT, you can easily see the advantages of using a
screen definition. All switches just described are applicable in a screen
definition, including Query, Pause, and User input. Windows will be displayed
in the order that they are read from the file. A pause with the third window
causes the pause to take place after the third window is displayed.
In the batch file, the syntax for using a screen definition is:
SW @filename [label]
The definition can be in a separate file or even within the same batch file.
The optional label is used when more than one definition is in the file. The
default label is 'Display'. 'End_Display' marks the end of the definition.
What follows is a breakdown of a portion of one of the screen defini-
tions that can be found in SW43DEMO.BAT. There are a total of 5 definitions
used by the demonstration, three of which are within the batch file and two
are from external files. The first column contains a short description of the
line in the second column.
┌─────────────────────┬─────────────────────────────────────────────────────┐
│Default Label │ :Display │
│first window │ _window /kcya┼ /r2 /s /bred /w /0 │
│text 1 │ SW.EXE - Expanded Text Handling! │
│text 2, new color │ /tWHI+ Multiple Windows! │
│text 3, footer │ /m v 4.3 │
│2nd window │ _window /r10 /s /bwhi /gblu /l1 /fred /0 │
│text 1, new color │ /tBLU Optional Command Line Syntax: │
│text 2 │ SW @filename [label] │
│3rd window │ _window /r16 /s /bwhi /gblu /l1 /fred /0 │
│text 1, new color │ /tBLU SW 4.x ADDITIONAL FEATURES │
│text 2, fill line │ /tred /─ │
│text 3, justify left │ /jl - Define the entire screen with multiple windows│
│text 4 │ using external text files. │
│4th window, pause │ _window /r25 /l0 /0 /p100- │
│text 1 │ - Press any key for more - │
│5th window, pause │ _window /r19 /bwhi /gblu /l0 /jl /0 /p100- │
│text 1 │ - Text handling can be expanded to 20 single-spaced │
│text 2 │ lines per window. │
│. │ . │
│. │ . │
│Final label │ :End_Display │
└─────────────────────┴─────────────────────────────────────────────────────┘
Page 12
SW.EXE 4.2a
Warren Small
(c) 1992
The _window line contains the switches that describe the window and
screen and have the same form as they would on a command line, preceded by a
slash and separated by a space. The lines that follow will be interpreted as
text until another '_window' or the 'end_display' label is found.
The text switches can appear on the same line preceding the text. The /t
switch is used to change the color one line of text and is separated from the
text by a space. /g can be used before a text line to change the color of the
rest of the lines. /j can be used to change the text alignment and /m is used
to specify a border message. Multiple switches can precede the text. The text
can be enclosed by quotes if additional spaces before or after are desired.
This example has 4 pauses and defines small windows that fit inside larger
ones to change the text without redrawing the whole window.
If a different label is needed, simply substitute it for 'Display'. The
label can be up to 15 characters. In SW43DEMO.BAT the other 2 definitions use
the labels 'Snd_Menu' and '4.3'.
Note that when using the /k switch with a fill string in a screen
definition, do not use quotes around the fill string. This is necessary
because of the way the switch is processed when using the screen definition.
As before, if you need spaces within the string, use the underscore (_)
character. It will be replaced with a space.
A Query will have to be the last item in the definition for the return
code to be valid. User Input can occur anywhere but you will have to wait for
the entire definition to be displayed before checking the answer.
Environment variables will be evaluated when included inside a screen
definition. This enables you to create a screen to display the user's answers
or other information without having to resort to the command line mode. If
the variable is not found, the variable name will be displayed in the window
just as it appears in the screen definition.
It is possible to "nest" screen definitions. One potential use is to
reuse a portion of one definition and add a new window to it. Here's what a
simple example would look like:
:Display1
:Display2
_window ...
text
:End_Display1
_window ...
text
:End_Display2
The command "SW @file Display1" would show only the first window and "SW
@file Display2" would display both. Any line beginning with a colon (:) is
ignored by SW. The possibilities are endless and could save you some disk
space.
Page 13
SW.EXE 4.2a
Warren Small
(c) 1992
TIPS AND TRICKS
- Change the contents of a window without redrawing the whole thing. Use
the /l0 and /0 switches to create a window just big enough for the text and
without a border. This way you can overwrite part or all of the inside of a
window and change the text in a flash. The first demo screen definition above
uses this technique.
- Use the ECHO batch file command to create screen definitions "on the
fly". If you use the redirect character > and the redirect with append >> you
can build a screen definition while running the batch file. In SW43DEMO.BAT,
this method is used to create the help screen for DI.EXE. Here is a portion:
echo :Display > di.hlp
echo _window /kmag▒─┼─▒ /s /bred /r2 /0 /w >> di.hlp
echo SW.EXE - Now with DI!>> di.hlp
echo /mc v 4.2 >> di.hlp
echo _window /jl /s /0 /r9 >> di.hlp
echo /mc Disk Information >> di.hlp
echo.>> di.hlp
di >> di.hlp
echo. >> di.hlp
echo _window /r25 /bblu /l0 /0 /p300- >> di.hlp
echo - Press any key to continue - >> di.hlp
echo :End_Display >> di.hlp
The first line creates the file "di.hlp" and the following lines append to
it. Then you call SW @di.hlp. Please note that, if quotes are used around any
strings, the >> should be placed directly after the end quote so there won't
be a space after it in the file. If there is a space, SW would display the
end quote in the window which is probably not desirable. You should also keep
in mind when capturing text from another program, that any text longer than
70 characters will be truncated and should be less than 20 lines long. If
more lines are found they are ignored. This way you can show the result of an
operation without destroying the look of the screen.
- Use the Enhanced text color attribute (/e#) to display text in two
colors on the same line. You could make whole words stand out in this manner.
SW /tRED /eRED+ "~B~l~i~n~k~i~n~g Red"
- If you want to display an empty window, set the size with /r#### and
/c####, then pass one space in a string. SW /r814 /c2060 " "
- Use a FOR loop to evaluate errorlevels returned by a Query. Although
it is slower and requires the use of numbered labels, it can shorten a long
series of IF ERRORLEVELs to one line. In the demo batch file, the sound menu
uses this line to select the sound:
for %%e in (1 2 3 4 5 6 7 8 9 10 11 12) do if errorlevel %%e goto beep%%e
Page 14
SW.EXE 4.2a
Warren Small
(c) 1992
SHAREWARE INFORMATION
These programs are "shareware". You are allowed to use the programs,
free of charge, for a reasonable amount of time. If you find them to be
useful, and continue to utilize them, a registration fee of $15 is required.
This will entitle you to personal notification of future releases and give
your suggestions for enhancements more value.
*** NEW PROGRAMS! ***
Anyone registering SW 4.3 will receive a disk with the latest version,
plus an additional program, SWV.EXE. This program is a simple text file
viewer that integrates with SW. SW can generate a window and then call SWV to
display the file within that window. This can be indispensable when a batch
file needs to display a large amount of information with only a little work.
SWV includes features like Search, Place Marks, and Zoom to full screen. SWV
can be used as a stand-alone as well and is EGA 43 and VGA 50 line aware.
You will also receive SW-DIR.EXE, a pop-up file directory for batch
files. It inherits many of the appearance switches of SW while allowing the
user to pick from the file list and return the name through the environment.
DOS 3.3 or higher is required.
Registered SW 3.x users can upgrade to SW 4.3 for $5. This is a free
upgrade for SW 4.x users. 4.x users who wish to receive SWV and SW-DIR can do
so by sending $2.50 for postage and handling to the address below. Please
specify disk size. The file SW-43.REG is provided to simplify registration
and ordering.
Site licenses can be negotiated. Feel free to give it to friends or
upload the original ZIP file to other BBS's provided that no fee is charged
for distribution and it is not modified in any way. Note to BBS Sysops:
Please post this ZIP as is, with all files included, and without changing the
ZIP filename.
SW.EXE Ver. 4.3 - July 11, 1992
Warren Small CIS 71076,407
35 Benjamin Street GEnie W.SMALL
Manchester, NH 03109 Prodigy RSJW31A
Page 15
SW.EXE 4.2a
Warren Small
(c) 1992
SW.EXE History
3.6 - 12/31/89 First general release.
3.7 - 02/01/90 Increased text lines to 5. Colors can be specified with 3
letter codes. Added Here (/h#), Double Spacing (/2), No Margin (/0), Enhanced
text color (/e#).
3.8 - 04/22/91 Added 3 border styles, 3 shadow positions, Pause Inter-
rupt (/p#-), User Input (/i#).
4.0 - 10/31/91 User Input changed to modify environment rather than
create SW-ENV.BAT. Removed limit on Highlighting. Added custom window border
(/l#char), Border Message (/m#), Justify (/j#), Outside Edge color (/o#), 9
Alert sounds (/a#), Wide window edge (/w), Foreground color for screen (/k#
/k#), Query wildcard, default, and Pause timeout (/q*^ /p#-), Window size
control (/r# /r# /c# /c#). Screen Definitions introduced.
4.1 - 12/1/91 Enhanced User Input. Pause, Query and User Input window
changed to popup style. Added Fill String (/k#string), Zoom Window (/z),
Input Line (/n#), Uppercase Input (/u), Draw Window to override popup (/d),
custom environment variables (/i#var). New utility added to check disks
(DI.EXE).
4.2 - 2/2/92 Added Fill Line (/char), shorthand window sizing (/r####
/c####), Alert Freq, Duration (/a#,#) or Note, Duration (/aN,#), key buffer
flush option for /Q and /I, default value for /I by setting environment
variable, Window appearance modified slightly for bordered (1-4) and border-
less windows. 5 text line limit removed from command line form of SW.
Environment variables are now evaluated inside screen definitions.
4.2a - 2/29/92 Fixed bug in environment variable evaluation in screen
files which caused rest of file to be read improperly. Added another Query
default indicator ^ for compatibility with NDOS. User Input enhanced to allow
large string input in small fields (/I####).
4.3 - 7/11/92 /x# added for EGA 43 line & VGA 50 line modes. SW now also
detect and setup 43 and 50 line modes. Text lines longer than 70 characters
are truncated without displaying an error. "Nested" labels possible in screen
defs.
Page 16